/*
package com.jingdianjichi.subject.infra.basic.utils;

import com.alibaba.druid.filter.config.ConfigTools;

import java.security.NoSuchAlgorithmException;
import java.security.NoSuchProviderException;

*/
/**
 * druid数据源密码加密
 *//*

public class DruidEncryptUtil {

    static String publicKey;
    static String privateKey;

    static{
        try {
            String[] pair = ConfigTools.genKeyPair(512);
            privateKey = pair[0];
            System.out.println("privateKey:" + privateKey);
            publicKey = pair[1];
            System.out.println("publicKey:" + publicKey);
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException(e);
        } catch (NoSuchProviderException e) {
            throw new RuntimeException(e);
        }
    }

    public static String encrypt(String text) {
        try {
            return ConfigTools.encrypt(privateKey, text);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public static String decrypt(String text) {
        try {
            return ConfigTools.decrypt(privateKey, text);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public static void main(String[] args) {
        System.out.println("ip"+encrypt("localhost:3306"));
        System.out.println("root"+encrypt("root"));
        System.out.println("pass"+encrypt("123456"));
    }
}
*/
